home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14131 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  1.6 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 6e 6f | 63 2e 6e 65 74 63 6f 6d |Path: no|c.netcom|
|00000010| 2e 6e 65 74 21 6e 65 77 | 73 0a 46 72 6f 6d 3a 20 |.net!new|s.From: |
|00000020| 54 61 72 61 6e 67 20 44 | 65 73 68 70 61 6e 64 65 |Tarang D|eshpande|
|00000030| 20 3c 74 61 72 61 6e 67 | 40 77 69 6c 6c 6f 77 73 | <tarang|@willows|
|00000040| 2e 63 6f 6d 3e 0a 4e 65 | 77 73 67 72 6f 75 70 73 |.com>.Ne|wsgroups|
|00000050| 3a 20 63 6f 6d 70 2e 6c | 61 6e 67 2e 63 0a 53 75 |: comp.l|ang.c.Su|
|00000060| 62 6a 65 63 74 3a 20 52 | 65 3a 20 4e 65 65 20 68 |bject: R|e: Nee h|
|00000070| 65 6c 70 20 77 69 74 68 | 20 61 20 73 74 72 69 6e |elp with| a strin|
|00000080| 67 20 61 6e 64 20 74 65 | 6d 70 20 73 74 72 69 6e |g and te|mp strin|
|00000090| 67 0a 44 61 74 65 3a 20 | 54 68 75 2c 20 31 31 20 |g.Date: |Thu, 11 |
|000000a0| 41 70 72 20 31 39 39 36 | 20 31 38 3a 33 30 3a 34 |Apr 1996| 18:30:4|
|000000b0| 36 20 2d 30 37 30 30 0a | 4f 72 67 61 6e 69 7a 61 |6 -0700.|Organiza|
|000000c0| 74 69 6f 6e 3a 20 4e 45 | 54 43 4f 4d 20 4e 65 74 |tion: NE|TCOM Net|
|000000d0| 77 6f 72 6b 20 4f 70 65 | 72 61 74 69 6f 6e 73 0a |work Ope|rations.|
|000000e0| 4d 65 73 73 61 67 65 2d | 49 44 3a 20 3c 33 31 36 |Message-|ID: <316|
|000000f0| 44 42 32 34 36 2e 37 34 | 46 42 40 77 69 6c 6c 6f |DB246.74|FB@willo|
|00000100| 77 73 2e 63 6f 6d 3e 0a | 52 65 66 65 72 65 6e 63 |ws.com>.|Referenc|
|00000110| 65 73 3a 20 3c 33 31 36 | 43 37 32 43 43 2e 37 36 |es: <316|C72CC.76|
|00000120| 33 41 40 63 6c 6f 75 64 | 6e 65 74 2e 63 6f 6d 3e |3A@cloud|net.com>|
|00000130| 0a 4e 4e 54 50 2d 50 6f | 73 74 69 6e 67 2d 48 6f |.NNTP-Po|sting-Ho|
|00000140| 73 74 3a 20 64 61 66 66 | 79 2e 77 69 6c 6c 6f 77 |st: daff|y.willow|
|00000150| 73 2e 63 6f 6d 0a 4d 69 | 6d 65 2d 56 65 72 73 69 |s.com.Mi|me-Versi|
|00000160| 6f 6e 3a 20 31 2e 30 0a | 43 6f 6e 74 65 6e 74 2d |on: 1.0.|Content-|
|00000170| 54 79 70 65 3a 20 74 65 | 78 74 2f 70 6c 61 69 6e |Type: te|xt/plain|
|00000180| 3b 20 63 68 61 72 73 65 | 74 3d 75 73 2d 61 73 63 |; charse|t=us-asc|
|00000190| 69 69 0a 43 6f 6e 74 65 | 6e 74 2d 54 72 61 6e 73 |ii.Conte|nt-Trans|
|000001a0| 66 65 72 2d 45 6e 63 6f | 64 69 6e 67 3a 20 37 62 |fer-Enco|ding: 7b|
|000001b0| 69 74 0a 58 2d 4d 61 69 | 6c 65 72 3a 20 4d 6f 7a |it.X-Mai|ler: Moz|
|000001c0| 69 6c 6c 61 20 32 2e 30 | 47 6f 6c 64 42 32 20 28 |illa 2.0|GoldB2 (|
|000001d0| 57 69 6e 39 35 3b 20 49 | 29 0a 54 6f 3a 20 22 52 |Win95; I|).To: "R|
|000001e0| 61 6e 64 61 6c 6c 20 4a | 2e 20 50 66 65 69 66 65 |andall J|. Pfeife|
|000001f0| 72 22 20 3c 72 70 66 65 | 69 66 65 72 40 63 6c 6f |r" <rpfe|ifer@clo|
|00000200| 75 64 6e 65 74 2e 63 6f | 6d 3e 0a 0a 52 61 6e 64 |udnet.co|m>..Rand|
|00000210| 61 6c 6c 20 4a 2e 20 50 | 66 65 69 66 65 72 20 77 |all J. P|feifer w|
|00000220| 72 6f 74 65 3a 0a 3e 20 | 0a 3e 20 49 20 61 6d 20 |rote:.> |.> I am |
|00000230| 77 72 69 74 69 6e 67 20 | 61 20 70 72 6f 67 72 61 |writing |a progra|
|00000240| 6d 20 74 68 61 74 20 72 | 65 61 64 73 20 64 61 74 |m that r|eads dat|
|00000250| 61 2c 20 76 61 6c 69 64 | 61 74 65 73 20 69 74 2c |a, valid|ates it,|
|00000260| 20 61 6e 64 20 74 68 65 | 6e 20 77 72 69 74 65 73 | and the|n writes|
|00000270| 20 69 74 20 74 6f 20 61 | 20 6e 65 77 20 66 69 6c | it to a| new fil|
|00000280| 65 2e 0a 3e 20 2e 2e 2e | 0a 3e 20 0a 3e 20 4d 79 |e..> ...|.> .> My|
|00000290| 20 70 72 6f 62 6c 65 6d | 20 69 6e 76 6f 6c 76 65 | problem| involve|
|000002a0| 73 20 6c 69 6e 65 73 20 | 32 20 74 68 72 6f 75 67 |s lines |2 throug|
|000002b0| 68 20 58 2e 0a 3e 20 20 | 20 52 65 61 64 69 6e 67 |h X..> | Reading|
|000002c0| 20 74 68 65 20 64 61 74 | 61 20 69 73 20 66 69 6e | the dat|a is fin|
|000002d0| 65 2e 20 48 6f 77 65 76 | 65 72 2c 20 77 68 65 6e |e. Howev|er, when|
|000002e0| 20 49 20 65 76 61 6c 75 | 61 74 65 20 74 68 65 20 | I evalu|ate the |
|000002f0| 63 6f 6d 70 6f 6e 65 6e | 74 73 20 61 6e 64 20 77 |componen|ts and w|
|00000300| 72 69 74 65 20 74 68 65 | 6d 20 74 6f 20 74 68 65 |rite the|m to the|
|00000310| 0a 3e 20 20 20 62 75 66 | 66 65 72 20 74 68 65 20 |.> buf|fer the |
|00000320| 70 72 65 76 69 6f 75 73 | 20 6c 69 6e 65 73 20 64 |previous| lines d|
|00000330| 61 74 61 20 73 74 69 6c | 6c 20 72 65 73 69 64 65 |ata stil|l reside|
|00000340| 73 20 69 6e 20 74 68 65 | 20 73 74 72 69 6e 67 2e |s in the| string.|
|00000350| 0a 3e 20 0a 3e 20 48 6f | 77 20 63 61 6e 20 49 20 |.> .> Ho|w can I |
|00000360| 67 65 74 20 72 69 64 20 | 6f 66 20 74 68 65 20 6f |get rid |of the o|
|00000370| 6c 64 20 6c 69 6e 65 73 | 20 64 61 74 61 20 69 6e |ld lines| data in|
|00000380| 20 6d 79 20 74 65 6d 70 | 20 73 74 72 69 6e 67 2e | my temp| string.|
|00000390| 0a 3e 20 2e 2e 2e 0a 3e | 20 0a 3e 20 76 6f 69 64 |.> ....>| .> void|
|000003a0| 20 65 78 61 6d 69 6e 65 | 42 63 61 72 64 28 29 0a | examine|Bcard().|
|000003b0| 3e 20 7b 20 69 6e 74 20 | 72 65 73 75 6c 74 3b 0a |> { int |result;.|
|000003c0| 3e 20 0a 3e 20 20 20 73 | 74 72 6e 63 70 79 28 42 |> .> s|trncpy(B|
|000003d0| 63 61 72 64 2c 22 42 22 | 2c 31 29 3b 0a 3e 20 20 |card,"B"|,1);.> |
|000003e0| 20 73 74 72 6e 63 61 74 | 28 42 63 61 72 64 2c 26 | strncat|(Bcard,&|
|000003f0| 6c 69 6e 65 5b 31 5d 2c | 31 29 3b 0a 3e 20 20 20 |line[1],|1);.> |
|00000400| 73 74 72 6e 63 61 74 28 | 42 63 61 72 64 2c 20 53 |strncat(|Bcard, S|
|00000410| 70 61 63 65 2c 33 29 3b | 0a 3e 20 0a 3e 20 20 20 |pace,3);|.> .> |
|00000420| 70 61 64 72 69 67 68 74 | 28 42 63 61 72 64 2c 35 |padright|(Bcard,5|
|00000430| 2c 37 2c 33 2c 33 29 3b | 0a 3e 20 20 20 70 61 64 |,7,3,3);|.> pad|
|00000440| 72 69 67 68 74 28 42 63 | 61 72 64 2c 38 2c 31 32 |right(Bc|ard,8,12|
|00000450| 2c 35 2c 35 29 3b 0a 3e | 20 20 20 70 61 64 72 69 |,5,5);.>| padri|
|00000460| 67 68 74 28 42 63 61 72 | 64 2c 31 33 2c 31 38 2c |ght(Bcar|d,13,18,|
|00000470| 36 2c 36 29 3b 0a 3e 20 | 20 20 73 74 72 6e 63 61 |6,6);.> | strnca|
|00000480| 74 28 42 63 61 72 64 2c | 22 20 22 2c 31 29 3b 2e |t(Bcard,|" ",1);.|
|00000490| 2e 2e 0a 0a 4e 6f 74 65 | 20 74 68 61 74 20 69 6e |....Note| that in|
|000004a0| 20 43 20 74 68 65 20 65 | 6e 64 20 6f 66 20 61 20 | C the e|nd of a |
|000004b0| 73 74 72 69 6e 67 20 69 | 73 20 6d 61 72 6b 65 64 |string i|s marked|
|000004c0| 20 62 79 20 61 20 6e 75 | 6c 6c 20 63 68 61 72 61 | by a nu|ll chara|
|000004d0| 63 74 65 72 20 6f 72 0a | 63 68 61 72 28 30 29 2e |cter or.|char(0).|
|000004e0| 20 20 59 6f 75 72 20 63 | 61 6c 6c 20 74 6f 20 73 | Your c|all to s|
|000004f0| 74 72 6e 63 70 79 20 69 | 73 20 65 71 75 69 76 69 |trncpy i|s equivi|
|00000500| 6c 61 6e 74 20 74 6f 20 | 74 68 65 20 66 6f 6c 6c |lant to |the foll|
|00000510| 6f 77 69 6e 67 3a 0a 0a | 42 63 61 72 64 20 5b 20 |owing:..|Bcard [ |
|00000520| 30 20 5d 20 3d 20 27 42 | 27 3b 0a 42 63 61 72 64 |0 ] = 'B|';.Bcard|
|00000530| 20 5b 20 31 20 5d 20 3d | 20 27 5c 30 27 3b 0a 0a | [ 1 ] =| '\0';..|
|00000540| 54 68 65 20 63 61 6c 6c | 20 69 6e 20 6e 6f 20 77 |The call| in no w|
|00000550| 61 79 20 61 66 66 65 63 | 74 73 20 42 63 61 72 64 |ay affec|ts Bcard|
|00000560| 20 5b 20 78 20 5d 20 77 | 68 65 72 65 20 78 20 3e | [ x ] w|here x >|
|00000570| 3d 20 32 2e 20 20 49 20 | 73 75 73 70 65 63 74 20 |= 2. I |suspect |
|00000580| 74 68 61 74 0a 74 68 65 | 20 70 72 6f 62 6c 65 6d |that.the| problem|
|00000590| 20 69 73 20 69 6e 20 79 | 6f 75 20 70 61 64 72 69 | is in y|ou padri|
|000005a0| 67 68 74 20 66 75 6e 63 | 74 69 6f 6e 20 77 68 69 |ght func|tion whi|
|000005b0| 63 68 20 64 6f 65 73 20 | 6e 6f 74 20 70 75 74 20 |ch does |not put |
|000005c0| 61 20 74 72 61 69 6c 69 | 6e 67 0a 6e 75 6c 6c 20 |a traili|ng.null |
|000005d0| 63 68 61 72 61 63 74 65 | 72 20 61 74 20 74 68 65 |characte|r at the|
|000005e0| 20 65 6e 64 2e 20 20 54 | 68 69 73 20 69 73 20 6f | end. T|his is o|
|000005f0| 6e 65 20 73 6f 6c 75 74 | 69 6f 6e 2e 20 20 41 6e |ne solut|ion. An|
|00000600| 6f 74 68 65 72 20 77 6f | 75 6c 64 20 62 65 0a 74 |other wo|uld be.t|
|00000610| 6f 20 69 6e 73 65 72 74 | 20 74 68 65 20 66 6f 6c |o insert| the fol|
|00000620| 6c 6f 77 69 6e 67 20 6c | 69 6e 65 20 62 65 66 6f |lowing l|ine befo|
|00000630| 72 65 20 79 6f 75 72 20 | 63 61 6c 6c 20 74 6f 20 |re your |call to |
|00000640| 73 74 72 6e 63 70 79 3a | 0a 0a 6d 65 6d 73 65 74 |strncpy:|..memset|
|00000650| 20 28 20 42 63 61 72 64 | 2c 20 30 2c 20 73 69 7a | ( Bcard|, 0, siz|
|00000660| 65 6f 66 20 28 20 42 63 | 61 72 64 20 29 20 29 3b |eof ( Bc|ard ) );|
|00000670| 0a 0a 43 68 65 65 72 73 | 2c 0a 0a 54 61 72 61 6e |..Cheers|,..Taran|
|00000680| 67 0a | |g. | |
+--------+-------------------------+-------------------------+--------+--------+